package com.adcc.foc.domain;

import java.util.List;

/**
 * Created by houxy on 2016/8/3.
 *
 * @author houxy
 * 树形结构的实体类
 */
public class TreeNode {
    public String id;
    public String pId;
    public String name;
    public String level;
    public String icon;
    public String open;

    public TreeNode() {
    }

    public TreeNode(String id, String pId, String name, String open) {
        this.id = id;
        this.pId = pId;
        this.name = name;
        this.icon = "resources/images/tree-file.png";
        this.open = open;
    }

    public static List<TreeNode> setOpenById(List<TreeNode> tnList, String OpenId) {
        String[] openids = OpenId.split("@");
        for (TreeNode tn : tnList) {
            for (int i = 0; i < openids.length; i++) {
                //设置节点是否打开
                //if(tn.id.equals(openids[i]))
                tn.open = "true";
            }
        }
        return tnList;
    }

    public String getId() {
        return this.id;
    }

    public String getPId() {
        return this.pId;
    }

    public String getName() {
        return name;
    }

    public String getLevel() {
        return level;
    }

    public String getIcon() {
        return icon;
    }

    public String getOpen() {
        return open;
    }
}
